package org.urchr.beorganized.api.impl.permission;

import org.urchr.beorganized.api.base.PrivateBaseAPIServlet;
import org.urchr.beorganized.dao.NotesDAO;
import org.urchr.beorganized.dao.PermissionsDAO;
import org.urchr.beorganized.dao.XMLDocumentBuilder;
import org.urchr.beorganized.dao.errors.GeneralException;

public class RemovePermission extends PrivateBaseAPIServlet {

	@Override
	protected void doProcessPrivate() throws GeneralException {
		int noteID = NotesDAO.safeInt(request.getParameter("noteid"), -1);
		int permisssionID = NotesDAO.safeInt(request.getParameter("permissionid"), -1);
		
		PermissionsDAO.removePermission(userID, noteID, permisssionID);
		XMLDocumentBuilder doc = new XMLDocumentBuilder();
		sendNode(doc.getRootElement("ok"));
	}

}
